﻿using System;
using ToMIC.Identity;

namespace StudentTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var s1 = new Student()
            {
                FirstName = "John",
                LastName = "Smith",
                Course = new TrainingCourse() { Name = "C#" },
                Email = "john.smith@microsoft.com"
            };

            var emailContact1 = new EmailContact(s1);

            var s2 = new Student()
            {
                FirstName = "Bob",
                LastName = "Dylan",
                Course = new TrainingCourse() { Name = "C++" },
                Email = "bob.dylan@yahoo.com"
            };

            var emailContact2 = new EmailContact(s2);

            EmailingList list = new EmailingList();
            list.Add(emailContact1);
            list.Add(emailContact2);

            Console.WriteLine(list);

            var el = EmailingList.Parse(list.ToString());

            if (list.ToString() == el.ToString())
            {
                Console.WriteLine("PASS");
            }

            var taxiDriver = new TaxiDriver() 
            { 
                FirstName = "Tom",
                LastName = "Cruise",
                License = new DrivingLicense()
            };

            //exception
            //emailContact = new EmailContact(taxiDriver);

            var s = "John Smith<john.smith@microsoft.com>;";
            var t = EmailContact.Parse(s);


            if (t.ToString() == s)
            {
                Console.WriteLine("PASS");
            }
            else
            {
                Console.WriteLine("FAIL");
                Console.WriteLine(t.Email);
                Console.WriteLine(t.FullName);
            }

            Console.ReadKey();
        }
    }
}
